﻿using Aker.DevTeam;
using Extensions;
using System;
using System.Data;

namespace Aker.Uretim
{
    public partial class Satinalma : XForm
    {
        public Satinalma()
        {
            InitializeComponent();
        }

        private void Satinalma_Load(object sender, EventArgs e)
        {
            DataTable dt = Data.DM.ExecuteDataTable("");
            gv.Init(dt);
            GridMenu gm = GridManager.GetManager(gv).GridMenu;
            gm.AddMenu("Giriş yap", GirisYap);
            gv.BestFitColumns();
        }

        private void GirisYap(object sender, EventArgs e)
        {
            DataRow dr = gv.GetFocusedDataRow();
            if (dr != null)
            {
                if (dr["IplikId"].ToIntNN() != -1)
                    AppSession.MainForm.ShowMdiChildForm(typeof(Hammadde.Iplik));
                else
                    AppSession.MainForm.ShowMdiChildForm(typeof(Hammadde.Elyaf));
            }
        }
    }
}